package com.sanhuo.idms.controller;

import com.sanhuo.idms.bo.CollegeSaveBO;
import com.sanhuo.idms.entity.College;
import com.sanhuo.idms.service.CollegeService;
import com.sanhuo.security.uitls.UserHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("college")
@RestController
public class CollegeController {

    @Autowired
    private CollegeService collegeService;

    @RequestMapping("")
    public List<College> findAll() {
        return collegeService.findAll();
    }

    @RequestMapping("save")
    public void save(CollegeSaveBO bo) throws IllegalAccessException {
        collegeService.save(UserHolder.user(), bo);
    }

    @RequestMapping("remove")
    public void remove(String id) {
        collegeService.remove(id);
    }
}
